package main

func main() {

}

type Node struct {
	Val      int
	Children []*Node
}

func maxDepth(root *Node) (res int) {
	var back func(root *Node)
	deep := 0
	back = func(root *Node) {
		if root == nil {
			return
		}
		deep++
		if deep > res {
			res = deep
		}
		for _, node := range root.Children {
			back(node)
			deep--
		}
	}
	back(root)
	return
}
